import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    // 登录页
    {
      path: '/',
      name: 'login',
      component: (resolve) => require(['../pages/Login'], resolve),
    },
    {
      path: '/layout',
      name: 'layout',
      component: (resolve) => require(['../layout/Layout'], resolve),
      children: [
        // 首页
        {
          path: '/index',
          name: 'index',
          component: (resolve) => require(['../pages/index/Index'], resolve),
        },
        // 课程表
        {
          path: '/courseDetail',
          name: 'courseDetail',
          component: (resolve) => require(['../pages/courseDetail/CourseDetail'], resolve),
        },
        // 随堂练习
        {
          path: '/exercises',
          name: 'exercises',
          component: (resolve) => require(['../pages/exercises/Exercises'], resolve),
        },
        // 答题结果
        {
          path: '/exercisesResult',
          name: 'exercisesResult',
          component: (resolve) => require(['../pages/exercises/ExercisesResult'], resolve),
        },
        // 查看答题详情
        {
          path: '/exercisesReview',
          name: 'exercisesReview',
          component: (resolve) => require(['../pages/exercises/ExercisesReview'], resolve),
        },
        // 成绩页
        {
          path: '/score',
          name: 'score',
          component: (resolve) => require(['../pages/score/Score'], resolve),
        }
      ]
    },
    // 404页面
    {
      path: '*',
      component: (resolve) => require(['../pages/NotFound'], resolve)
    }
  ]
})
